package smedi.ismedi.mobile.bff.controller.authortiy;

import com.smedi.ismedi.authoritymanagement.api.dto.response.RoleBasicResponse;
import com.smedi.ismedi.authoritymanagement.api.feign.RemoteAuthorityRoleManagementFeignApi;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-7-4 15:45
 */
@Slf4j
@RestController
@Api(tags = {"权限管理角色配置接口"})
@RequestMapping("/mobilebff/v1/authority/roleManagement")
@AllArgsConstructor
public class AuthorityRoleManagementController {
    private final RemoteAuthorityRoleManagementFeignApi remoteAuthorityRoleManagementFeignApi;

    /**
     * 根据人员id获取所有角色
     *
     * @param personId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据人员id获取所有角色")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "personId", value = "人员id", dataType = "Long", dataTypeClass = Long.class),
    })
    @GetMapping(value = "/getQueryRolesByPersonId")
    public ResponseData<List<RoleBasicResponse>> getQueryRolesByPersonId(@RequestParam("personId") Long personId) {
        return remoteAuthorityRoleManagementFeignApi.getQueryRolesByPersonId(personId);
    }
}
